//
//  GameLogic.h
//  zhuan
//
//  Created by zhao ys on 5/27/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

//#import <Foundation/Foundation.h>
extern int remove_buttons_;
extern int score_;
extern int score_cur_;
extern int cur_level_;
extern float time_cost_;
extern float time_dec_;
extern float hint_time_;
extern float time_max_;
extern float add[4];

extern BOOL sound_on;
extern BOOL music_on;
extern BOOL game_center_on;
extern BOOL auto_play_on;

@protocol GameLogicDelegate
-(void)CreateButton:(int)type X:(int)x Y:(int)y;
-(void)AddTime;
@end


@interface GameLogic : NSObject {
	int row_;
	int col_;
	int type_cnt_;
	int count_per_type_;
	int * field_;
	int * field_org_;
	int left_buttons_;
	int start_score_;
    float time_left_;
	
	NSObject<GameLogicDelegate>* delegate; 
} 
@property (retain) NSObject<GameLogicDelegate>* delegate;

@property (readonly) int row;
@property (readonly) int col;
@property (readonly) int types;
@property (readonly) int left;
@property (readonly) float time_left;

-(void)addTime:(float)t;

+(void)ClassicMode;
+(void)ScoreMode;
+(void)EndlessMode;
+(BOOL)IsClassicMode;
+(BOOL)IsEndlessMode;
+(BOOL)IsScoreMode;
+(void)ResetGameConfig;

+(GameLogic*) sharedGameLogic;

-(int)gen;
-(int)gen:(int)row col:(int)col type_cnt:(int)type_cnt count_per_type:(int)count_per_type;
-(int)valueAt:(int)x Y:(int)y;
-(int)remove:(int)x Y:(int)y;
-(NSMutableArray*) hit:(int)x Y:(int)y;
-(NSMutableArray*) pathOf:(int)x Y:(int)y dest:(int)dest; 
-(BOOL) haveStep;
-(int) nextStep;
-(int)Restart;

-(void)save;
-(int)load;
-(BOOL) havesave;
-(void) cleansave;

@end
